<?php

namespace App\Model\Content;

use App\Model\CrudModel;

/**
 * @property int $id
 * @property string $content
 */
class LongTextModel extends CrudModel
{
    // 富文本等长文字内容
    protected ?string $table = 'long_text';

    protected array $adminPageListField = [
        'id', 'content',
    ];

    public function addOne(array $data)
    {
    }

    public function addOneGetId(array $data)
    {
        $add = [
            'content' => trim($data['content'] ?? ''),
        ];
        return $this->normalAddOneGetId($add);
    }

    public function updateById($id, array $data)
    {
        return $this->buildQuery(['id' => $id,])->update([
            'content' => trim($data['content'] ?? ''),
            'updated_at' => time(),
        ]);
    }

}